home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 24 / Amiga Format AFCD24 (Feb 1998, Issue 108).iso / -seriously_amiga- / shareware / programming / other / pmdev / demos / startmenu.c < prev   
C/C++ Source or Header  |  1998-01-05  |  18KB  |  413 lines

  1. //
  2. // $VER: StartMenu.c 2.3 (23.9.97)
  3. //
  4. // Popup Menu example program
  5. //
  6. // ©1996-1997 Henrik Isaksson
  7. // All Rights Reserved.
  8. //
  9. // Run and move the mouse pointer to the bottom of the screen!
  10. //
  11. // This demo is an example of real bad coding... A better version will follow soon!
  12. //
  13.  
  14. #include <intuition/intuition.h>
  15.  
  16. #include <datatypes/pictureclass.h>
  17.  
  18. #include <clib/intuition_protos.h>
  19. #include <clib/exec_protos.h>
  20. #include <clib/alib_protos.h>
  21.  
  22. #include <string.h>
  23. #include <stdio.h>
  24. #include <stdlib.h>
  25.  
  26. #include <libraries/pm.h>
  27. #include <proto/pm.h>
  28.  
  29. struct IntuitionBase    *IntuitionBase=NULL;
  30. struct GfxBase        *GfxBase=NULL;
  31. struct PopupMenuBase    *PopupMenuBase=NULL;
  32.  
  33. struct Window w;    // a faked window, don't try this at home... ;)
  34.  
  35. //
  36. // Image data
  37. //
  38.  
  39. UWORD chip nnData[558] =
  40. {
  41.     /* Plane 0 */
  42.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0100,0x0000,0x0000,
  43.     0x0000,0x0000,0x0000,0x0300,0x0000,0x0000,0x0000,0x0000,
  44.     0x0000,0x0300,0x0000,0x0000,0x0000,0x0000,0x0000,0x0300,
  45.     0x0FFF,0xFFF0,0x0000,0x0000,0x0000,0x0300,0x0FFF,0xFFF0,
  46.     0x0000,0x0000,0x0000,0x0300,0x0FFF,0xFFF0,0x0000,0x0000,
  47.     0x0003,0x8300,0x0FFF,0xFFF0,0x8BDF,0x3CF1,0x9EF2,0x4300,
  48.     0x0F8F,0xE1F0,0xCA04,0x2082,0x5280,0x8300,0x0FE7,0xFBF0,
  49.     0xABC4,0x3883,0xDEF1,0x0300,0x0FE3,0xFBF0,0x9A04,0x0482,
  50.     0x5081,0x0300,0x0FE9,0xFBF0,0x8BC4,0x3CF2,0x50F9,0x0300,
  51.     0x0FE8,0xFBF0,0x0000,0x0000,0x0000,0x0300,0x0FEC,0x7BF0,
  52.     0x0040,0x0000,0x001C,0x0300,0x0FEE,0x3BF0,0x18C0,0x0000,
  53.     0x0018,0x0300,0x0FEF,0x1BF0,0x38C0,0x0000,0x0018,0x0300,
  54.     0x0FEF,0x93F0,0x3CC0,0x0000,0x0018,0x0300,0x0FEF,0x83F0,
  55.     0x3CC0,0x0060,0x0038,0x0300,0x0FA0,0x01F0,0x3EC3,0xC0E7,
  56.     0xBBF8,0x0300,0x0000,0x0000,0x36C7,0xD9CF,0xBFF8,0x0300,
  57.     0x0000,0x0000,0x37CF,0x9DDF,0x1E38,0x0300,0x0000,0x0000,
  58.     0x33CF,0x7F9E,0xFC30,0x0300,0x0000,0x0000,0x33CC,0xFF19,
  59.     0xFC30,0x0300,0x0000,0x0000,0x31CF,0xEF1F,0xF830,0x0300,
  60.     0x0000,0x0000,0x30C7,0x8E0F,0x3800,0x0300,0x0000,0x0000,
  61.     0x3000,0x0000,0x1030,0x0300,0x0000,0x0000,0x0000,0x0000,
  62.     0x0030,0x0300,0x0000,0x0000,0x0000,0x0000,0x0030,0x0300,
  63.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0300,0x7FFF,0xFFFF,
  64.     0xFFFF,0xFFFF,0xFFFF,0xFF00,0xFFFF,0xFFFF,0xFFFF,0xFFFF,
  65.     0xFFFF,0xFF00,
  66.     /* Plane 1 */
  67.     0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFE00,0xFFFF,0xFFFF,
  68.     0xFFFF,0xFFFF,0xFFFF,0xFC00,0xC000,0x0000,0x0000,0x0000,
  69.     0x0000,0x0000,0xC000,0x0000,0x0000,0x0000,0x0000,0x0000,
  70.     0xC000,0x0000,0x0000,0x0000,0x0000,0x0000,0xC000,0x0000,
  71.     0x0000,0x0000,0x0000,0x0000,0xC000,0x0000,0x0000,0x0000,
  72.     0x0000,0x0000,0xC0E0,0x3200,0x0000,0x0000,0x0000,0x0000,
  73.     0xC0FB,0xBF00,0x0000,0x0000,0x0000,0x0000,0xCFFF,0xFC10,
  74.     0x0000,0x0000,0x0000,0x0000,0xCFFF,0xFED0,0x0000,0x0000,
  75.     0x0000,0x0000,0xCFFF,0xFFF0,0x0000,0x0000,0x0000,0x0000,
  76.     0xCFFF,0xFFF0,0x0000,0x0000,0x0000,0x0000,0xCFFF,0xFFF0,
  77.     0x0040,0x0000,0x001C,0x0000,0xCFFF,0xFFF0,0x18C0,0x0000,
  78.     0x0018,0x0000,0xCFFF,0xFFF0,0x38C0,0x0000,0x0018,0x0000,
  79.     0xCFFF,0xFFF0,0x3CC0,0x0000,0x0018,0x0000,0xCFFF,0xFFF0,
  80.     0x3CC0,0x0060,0x0038,0x0000,0xCFB0,0x09F0,0x3EC3,0xC0E7,
  81.     0xBBF8,0x0000,0xC030,0x0000,0x36C7,0xD9CF,0xBFF8,0x0000,
  82.     0xC030,0x0000,0x37CF,0x9DDF,0x1E38,0x0000,0xC000,0x0000,
  83.     0x33CF,0x7F9E,0xFC30,0x0000,0xC000,0x0000,0x33CC,0xFF19,
  84.     0xFC30,0x0000,0xC000,0x0000,0x31CF,0xEF1F,0xF830,0x0000,
  85.     0xC000,0x0000,0x30C7,0x8E0F,0x3800,0x0000,0xC000,0x0000,
  86.     0x3000,0x0000,0x1030,0x0000,0xC000,0x0000,0x0000,0x0000,
  87.     0x0030,0x0000,0xC000,0x0000,0x0000,0x0000,0x0030,0x0000,
  88.     0xC000,0x0000,0x0000,0x0000,0x0000,0x0000,0x8000,0x0000,
  89.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  90.     0x0000,0x0000,
  91.     /* Plane 2 */
  92.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  93.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  94.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  95.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  96.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  97.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  98.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  99.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  100.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  101.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  102.     0x0040,0x0000,0x001C,0x0000,0x0000,0x0000,0x18C0,0x0000,
  103.     0x0018,0x0000,0x0000,0x0000,0x38C0,0x0000,0x0018,0x0000,
  104.     0x0000,0x0000,0x3CC0,0x0000,0x0018,0x0000,0x0000,0x0000,
  105.     0x3CC0,0x0060,0x0038,0x0000,0x004F,0xF600,0x3EC3,0xC0E7,
  106.     0xBBF8,0x0000,0x0FCF,0xFFF0,0x36C7,0xD9CF,0xBFF8,0x0000,
  107.     0x0FCF,0xFFF0,0x37CF,0x9DDF,0x1E38,0x0000,0x0FFF,0xFFF0,
  108.     0x33CF,0x7F9E,0xFC30,0x0000,0x0FFF,0xFFF0,0x33CC,0xFF19,
  109.     0xFC30,0x0000,0x0FFF,0xFFF0,0x31CF,0xEF1F,0xF830,0x0000,
  110.     0x0FFF,0xFFF0,0x30C7,0x8E0F,0x3800,0x0000,0x0FFF,0xFFF0,
  111.     0x3000,0x0000,0x1030,0x0000,0x0FFF,0xFFF0,0x0000,0x0000,
  112.     0x0030,0x0000,0x0000,0x0000,0x0000,0x0000,0x0030,0x0000,
  113.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  114.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  115.     0x0000,0x0000
  116. };
  117.  
  118. struct Image nn =
  119. {
  120.     0, 0,        /* LeftEdge, TopEdge */
  121.     88, 31, 3,    /* Width, Height, Depth */
  122.     nnData,    /* ImageData */
  123.     0x0007, 0x0000,    /* PlanePick, PlaneOnOff */
  124.     NULL        /* NextImage */
  125. };
  126.  
  127. UWORD chip miamiselData[280] =
  128. {
  129.     /* Plane 0 */
  130.     0xFFFF,0xFFFF,0xFFFF,0xE000,0x8000,0x0000,0x0000,0x0000,
  131.     0x8000,0x0000,0x0000,0x0000,0x8FFF,0xFFFF,0xFFFF,0x0000,
  132.     0x8FFF,0xFFFF,0xFFFF,0x0000,0x8FFF,0xFD55,0xFFFF,0x0000,
  133.     0x8FFF,0xEAAA,0xFFFF,0x0000,0x8FFF,0x5555,0x7FFD,0x0000,
  134.     0x8FFF,0xFEAB,0xFFFF,0x0000,0x8FFD,0x57FF,0x5FFF,0x0000,
  135.     0x8FFF,0xAAAA,0xAFFF,0x0000,0x8FFD,0xD755,0x57FF,0x0000,
  136.     0x8FFB,0xEAAA,0xBBFF,0x0000,0x8FF7,0x5555,0xF7FF,0x0000,
  137.     0x8FFA,0xAAAB,0xABFF,0x0000,0x8FF7,0xD555,0x5DFF,0x0000,
  138.     0x8FFF,0xFFAA,0xEBFF,0x0000,0x8FF7,0xFD55,0x55FF,0x0000,
  139.     0x8FFE,0xEAAA,0xABFF,0x0000,0x8FF7,0x5555,0x55FF,0x0000,
  140.     0x8FFA,0xAAAA,0xABFF,0x0000,0x8FF7,0x5555,0x57FF,0x0000,
  141.     0x8FFA,0xAAAA,0xABFF,0x0000,0x8FFD,0x5555,0x57FF,0x0000,
  142.     0x8FFB,0xAAAA,0xABFF,0x0000,0x8FFD,0xD555,0x5FFF,0x0000,
  143.     0x8FFE,0xEAAA,0xFBFF,0x0000,0x8FFF,0x7555,0xDFFF,0x0000,
  144.     0x8FFF,0xBFAF,0xAFFF,0x0000,0x8FFF,0xD7FF,0x7FFF,0x0000,
  145.     0x8FFF,0xFBFA,0xFFFF,0x0000,0x8FFF,0xFD57,0xFFFF,0x0000,
  146.     0x8000,0x0000,0x0000,0x0000,0x8000,0x0000,0x0000,0x0000,
  147.     0x8000,0x0000,0x0000,0x0000,
  148.     /* Plane 1 */
  149.     0x0000,0x0000,0x0000,0x1000,0x0000,0x0000,0x0000,0x1000,
  150.     0x0000,0x0000,0x0000,0x1000,0x0FFF,0xFE97,0xFFFF,0x1000,
  151.     0x0FFF,0xF8F8,0xFFFF,0x1000,0x0FFF,0xFBFD,0x3FFF,0x1000,
  152.     0x00FF,0xEF4F,0x8FF6,0x1000,0x0FA1,0xF801,0xC6DD,0x1000,
  153.     0x0F7F,0x0203,0x5F7F,0x1000,0x0FFF,0xF73E,0x5FFF,0x1000,
  154.     0x0FFF,0x8BD5,0x1BFF,0x1000,0x0FFE,0x8200,0x1DFF,0x1000,
  155.     0x0FFE,0x8000,0x3DFF,0x1000,0x0FFD,0x00D8,0x06FF,0x1000,
  156.     0x0FF8,0x01FE,0x04FF,0x1000,0x0FFE,0x0366,0x0EFF,0x1000,
  157.     0x0FFC,0x03B6,0x46FF,0x1000,0x0FFE,0x03EB,0x02FF,0x1000,
  158.     0x0FFC,0x442B,0x06FF,0x1000,0x0FFE,0x0020,0x057F,0x1000,
  159.     0x0FF8,0x00A0,0x06FF,0x1000,0x0FFC,0x0060,0x06FF,0x1000,
  160.     0x0FFC,0x0060,0x0DFF,0x1000,0x0FFD,0x0060,0x07FF,0x1000,
  161.     0x0FFB,0x0060,0x1FFF,0x1000,0x0FFF,0x0070,0x1FFF,0x1000,
  162.     0x0FFF,0x82F6,0x57FF,0x1000,0x0FFF,0x87FF,0x9FFF,0x1000,
  163.     0x0FFF,0xF3F7,0xBFFF,0x1000,0x0FFF,0xF60D,0xFFFF,0x1000,
  164.     0x0FFF,0xFFDF,0xFFFF,0x1000,0x0FFF,0xFFFF,0xFFFF,0x1000,
  165.     0x0000,0x0000,0x0000,0x1000,0x0000,0x0000,0x0000,0x1000,
  166.     0x7FFF,0xFFFF,0xFFFF,0xF000
  167. };
  168.  
  169. struct Image miamisel =
  170. {
  171.     0, 0,        /* LeftEdge, TopEdge */
  172.     52, 35, 3,    /* Width, Height, Depth */
  173.     miamiselData,    /* ImageData */
  174.     0x0003, 0x0000,    /* PlanePick, PlaneOnOff */
  175.     NULL        /* NextImage */
  176. };
  177.  
  178. UWORD chip miamiunselData[280] =
  179. {
  180.     /* Plane 0 */
  181.     0x0000,0x0000,0x0000,0x1000,0x0000,0x0000,0x0000,0x1000,
  182.     0x0000,0x0000,0x0000,0x1000,0x0000,0x0000,0x0000,0x1000,
  183.     0x0000,0x0000,0x0000,0x1000,0x0000,0x07FE,0x0000,0x1000,
  184.     0x0000,0x1FFF,0x8000,0x1000,0x0400,0xBFFF,0xC002,0x1000,
  185.     0x00A8,0x01FC,0x0080,0x1000,0x0003,0xFC01,0xF000,0x1000,
  186.     0x0002,0x7FFF,0xF800,0x1000,0x0006,0x7DFF,0xF800,0x1000,
  187.     0x0004,0x3FFF,0xCC00,0x1000,0x000C,0xFFFF,0x4C00,0x1000,
  188.     0x000D,0xFFFC,0x7E00,0x1000,0x0008,0x3FFF,0xE600,0x1000,
  189.     0x0008,0x02FF,0xBE00,0x1000,0x0008,0x06BF,0xFE00,0x1000,
  190.     0x0009,0x1FFD,0x5E00,0x1000,0x0009,0xFFFF,0xFE00,0x1000,
  191.     0x000D,0xFF7F,0xFE00,0x1000,0x000D,0xFFFF,0xFC00,0x1000,
  192.     0x0005,0xFFFF,0xFC00,0x1000,0x0006,0xFFFF,0xF800,0x1000,
  193.     0x0006,0x7FFF,0xF400,0x1000,0x0003,0x3FFF,0xE000,0x1000,
  194.     0x0001,0xBFFF,0x8C00,0x1000,0x0000,0xCFFE,0x3000,0x1000,
  195.     0x0000,0x60F8,0x7000,0x1000,0x0000,0x3800,0xC000,0x1000,
  196.     0x0000,0x0EA7,0x8000,0x1000,0x0000,0x03FC,0x0000,0x1000,
  197.     0x0000,0x0000,0x0000,0x1000,0x0000,0x0000,0x0000,0x1000,
  198.     0x7FFF,0xFFFF,0xFFFF,0xF000,
  199.     /* Plane 1 */
  200.     0xFFFF,0xFFFF,0xFFFF,0xE000,0x8000,0x0000,0x0000,0x0000,
  201.     0x8000,0x0000,0x0000,0x0000,0x8000,0x0168,0x0000,0x0000,
  202.     0x8000,0x0707,0x0000,0x0000,0x8000,0x0402,0xC000,0x0000,
  203.     0x8F00,0x10B0,0x7009,0x0000,0x805E,0x07FE,0x3922,0x0000,
  204.     0x8080,0xFDFC,0xA080,0x0000,0x8000,0x08C1,0xA000,0x0000,
  205.     0x8000,0x742A,0xE400,0x0000,0x8001,0x7DFF,0xE200,0x0000,
  206.     0x8001,0x7FFF,0xC200,0x0000,0x8002,0xFF27,0xF900,0x0000,
  207.     0x8007,0xFE01,0xFB00,0x0000,0x8001,0xFC99,0xF100,0x0000,
  208.     0x8003,0xFC49,0xB900,0x0000,0x8001,0xFC14,0xFD00,0x0000,
  209.     0x8003,0xBBD4,0xF900,0x0000,0x8001,0xFFDF,0xFA80,0x0000,
  210.     0x8007,0xFF5F,0xF900,0x0000,0x8003,0xFF9F,0xF900,0x0000,
  211.     0x8003,0xFF9F,0xF200,0x0000,0x8002,0xFF9F,0xF800,0x0000,
  212.     0x8004,0xFF9F,0xE000,0x0000,0x8000,0xFF8F,0xE000,0x0000,
  213.     0x8000,0x7D09,0xA800,0x0000,0x8000,0x7800,0x6000,0x0000,
  214.     0x8000,0x0C08,0x4000,0x0000,0x8000,0x09F2,0x0000,0x0000,
  215.     0x8000,0x0020,0x0000,0x0000,0x8000,0x0000,0x0000,0x0000,
  216.     0x8000,0x0000,0x0000,0x0000,0x8000,0x0000,0x0000,0x0000,
  217.     0x8000,0x0000,0x0000,0x0000
  218. };
  219.  
  220. struct Image miamiunsel =
  221. {
  222.     0, 0,        /* LeftEdge, TopEdge */
  223.     52, 35, 3,    /* Width, Height, Depth */
  224.     miamiunselData,    /* ImageData */
  225.     0x0003, 0x0000,    /* PlanePick, PlaneOnOff */
  226.     NULL        /* NextImage */
  227. };
  228.  
  229. UWORD chip yamselData[348] =
  230. {
  231.     /* Plane 0 */
  232.     0xFFFF,0xFFFF,0xFFFF,0xFC00,0xFFFF,0xFFFF,0xFFFF,0xF800,
  233.     0xFFD7,0xFFFF,0xFFFF,0xF800,0xF9FD,0xFFFF,0xF9CC,0x7800,
  234.     0xBABF,0xEAAA,0xA88C,0x6800,0xF05B,0xFFFF,0xF18C,0x7800,
  235.     0xB00E,0xDEAA,0xA4CC,0x6800,0xE805,0xF7DD,0xC10C,0x5800,
  236.     0xB500,0xBDEA,0xB559,0x2800,0xAAA0,0xD731,0x0004,0x5000,
  237.     0xBF50,0x8DDA,0x9119,0x2800,0xBFEA,0x8AB8,0x2464,0x4000,
  238.     0xBFF4,0xDCD8,0xD119,0x2800,0xBFFE,0x9B28,0x8004,0x8000,
  239.     0xBFFE,0xF5D8,0x4001,0x0000,0xBFFE,0xBA98,0x8000,0x8000,
  240.     0xBFFE,0xB499,0x4411,0x0000,0xB7FF,0xFA6A,0x8A20,0x8000,
  241.     0x8DFF,0xF559,0x0411,0x0000,0x837F,0xFAAF,0x0821,0x8000,
  242.     0x80DF,0xF54D,0x1011,0x0000,0x8077,0xFA9E,0x2821,0x8000,
  243.     0x804D,0xF56C,0x1051,0x8000,0x8047,0x7B9C,0x6AB1,0x8000,
  244.     0x8044,0xD61C,0x7FF1,0x8000,0x8044,0x7800,0x0000,0x0000,
  245.     0x8044,0x0000,0x0000,0x0000,0x807C,0x0000,0x0000,0x0000,
  246.     0x8000,0x0000,0x0000,0x0000,
  247.     /* Plane 1 */
  248.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0400,
  249.     0x0008,0x0000,0x0000,0x0400,0x020E,0x0000,0x0000,0x0400,
  250.     0x054F,0x0000,0x0000,0x0400,0x0FA7,0x0000,0x0000,0x0400,
  251.     0x0FF1,0x0000,0x0440,0x0400,0x17FA,0x0000,0x0000,0x0400,
  252.     0x0AFE,0x4000,0x1551,0x0400,0x155E,0x2800,0x0000,0x0400,
  253.     0x00AE,0x7000,0x1111,0x0400,0x0014,0x7000,0x2020,0x0400,
  254.     0x000A,0x2000,0x5111,0x0400,0x0000,0x6000,0x8000,0x8400,
  255.     0x0000,0x0000,0x4001,0x0400,0x0000,0x4040,0x8000,0x8400,
  256.     0x0000,0x0041,0x4411,0x0400,0x0000,0x0002,0x8A20,0x8400,
  257.     0x0000,0x0001,0x0411,0x0400,0x0000,0x0007,0x0821,0x8400,
  258.     0x0000,0x0005,0x1011,0x0400,0x0000,0x0006,0x2821,0x8400,
  259.     0x0000,0x000C,0x1051,0x8400,0x0000,0x001C,0x6AB1,0x8400,
  260.     0x0000,0x001C,0x7FF1,0x8400,0x0000,0x0000,0x0000,0x0400,
  261.     0x0000,0x0000,0x0000,0x0400,0x0000,0x0000,0x0000,0x0400,
  262.     0x7FFF,0xFFFF,0xFFFF,0xFC00,
  263.     /* Plane 2 */
  264.     0x0000,0x0000,0x0000,0x0000,0x7E07,0xFFFF,0xFFFF,0xF800,
  265.     0x79E9,0xFFFF,0xFFFF,0xF800,0x75EE,0x7FFF,0xF9CC,0x7800,
  266.     0x22AF,0x2AAA,0xAEBD,0xE800,0x4047,0x0FFF,0xFFFD,0xF800,
  267.     0x1009,0x62AA,0xAABD,0xE800,0x4804,0x78DD,0xDFFD,0xD800,
  268.     0x1501,0x3E2A,0xAAA8,0xA800,0x0AA1,0x54D1,0x3FF5,0xD000,
  269.     0x1F51,0x0BEA,0xAAA8,0xA800,0x1FEB,0x07E0,0x57D5,0xC000,
  270.     0x1FF5,0x4630,0xA228,0xA800,0x1FFF,0x0ED0,0x6337,0x0000,
  271.     0x1FFF,0x6EF0,0xA000,0x8000,0x1FFF,0x2F21,0x4003,0x0000,
  272.     0x1FFF,0x2F30,0x9320,0x9000,0x0FFF,0x6F91,0x0413,0x0000,
  273.     0x53FF,0xEFF6,0xD964,0xD000,0x20FF,0xEFF0,0x3612,0x2000,
  274.     0x553F,0xEFF2,0x4D64,0xD000,0x2A8F,0xEFE0,0x929A,0x2800,
  275.     0x5513,0xEF93,0x6FA6,0x5000,0x6AB8,0xEE23,0x954A,0x3800,
  276.     0x5511,0x2941,0x0006,0x5000,0x7FBB,0x87FF,0xFFFF,0xF800,
  277.     0x7FBB,0xFFFF,0xFFFF,0xF800,0x7F83,0xFFFF,0xFFFF,0xF800,
  278.     0x0000,0x0000,0x0000,0x0000
  279. };
  280.  
  281. struct Image yamsel =
  282. {
  283.     0, 0,        /* LeftEdge, TopEdge */
  284.     54, 29, 3,    /* Width, Height, Depth */
  285.     yamselData,    /* ImageData */
  286.     0x0007, 0x0000,    /* PlanePick, PlaneOnOff */
  287.     NULL        /* NextImage */
  288. };
  289.  
  290. UWORD chip yamunselData[348] =
  291. {
  292.     /* Plane 0 */
  293.     0x0000,0x0000,0x0000,0x0000,0x7FFF,0xFFFF,0xFFFF,0xFC00,
  294.     0x7FFF,0xFFFF,0xFFFF,0xFC00,0x79FF,0xFFFF,0xF9CC,0x7C00,
  295.     0x3ABF,0xEAAA,0xA88C,0x6C00,0x7057,0x3FFF,0xF18C,0x7C00,
  296.     0x300B,0xDEAA,0xA4CC,0x6C00,0x6805,0x77DD,0xC10C,0x5C00,
  297.     0x3500,0xBDEA,0xB559,0x2C00,0x2AA0,0x5731,0x0004,0x5400,
  298.     0x3F50,0x0DDA,0x9119,0x2C00,0x3EEA,0x0AB8,0x2464,0x4400,
  299.     0x3DB5,0x5CD8,0xD119,0x2C00,0x3FDE,0x9B28,0x8004,0x8400,
  300.     0x3FB7,0x75D8,0x4001,0x0400,0x3FEC,0xBA98,0x8000,0x8400,
  301.     0x3FFB,0x3499,0x4411,0x0400,0x37FE,0xFA6A,0x8A20,0x8400,
  302.     0x0DFF,0xF559,0x0411,0x0400,0x037F,0xFAAF,0x0821,0x8400,
  303.     0x00DF,0xF54D,0x1011,0x0400,0x0077,0xFA9E,0x2821,0x8400,
  304.     0x004D,0xF56C,0x1051,0x8400,0x0047,0x7B9C,0x6AB1,0x8400,
  305.     0x0044,0xD61C,0x7FF1,0x8400,0x0044,0x7800,0x0000,0x0400,
  306.     0x0044,0x0000,0x0000,0x0400,0x007C,0x0000,0x0000,0x0400,
  307.     0x7FFF,0xFFFF,0xFFFF,0xFC00,
  308.     /* Plane 1 */
  309.     0xFFFF,0xFFFF,0xFFFF,0xFC00,0x8000,0x0000,0x0000,0x0000,
  310.     0x8000,0x0000,0x0000,0x0000,0x8200,0x0000,0x0000,0x0000,
  311.     0x8540,0x0000,0x0000,0x0000,0x8FA8,0x0000,0x0000,0x0000,
  312.     0x8FF4,0x0000,0x0440,0x0000,0x97FA,0x8000,0x0000,0x0000,
  313.     0x8AFF,0x4000,0x1551,0x0000,0x955F,0xA800,0x0000,0x0000,
  314.     0x80AF,0xF000,0x1111,0x0000,0x8015,0xF000,0x2020,0x0000,
  315.     0x820A,0xA000,0x5111,0x0000,0x8301,0x6000,0x8000,0x8000,
  316.     0x8300,0x8000,0x4001,0x0000,0x8300,0x4040,0x8000,0x8000,
  317.     0x8100,0x0041,0x4411,0x0000,0x8000,0x0002,0x8A20,0x8000,
  318.     0x8000,0x0001,0x0411,0x0000,0x8000,0x0007,0x0821,0x8000,
  319.     0x8000,0x0005,0x1011,0x0000,0x8000,0x0006,0x2821,0x8000,
  320.     0x8000,0x000C,0x1051,0x8000,0x8000,0x001C,0x6AB1,0x8000,
  321.     0x8000,0x001C,0x7FF1,0x8000,0x8000,0x0000,0x0000,0x0000,
  322.     0x8000,0x0000,0x0000,0x0000,0x8000,0x0000,0x0000,0x0000,
  323.     0x8000,0x0000,0x0000,0x0000,
  324.     /* Plane 2 */
  325.     0x0000,0x0000,0x0000,0x0000,0x7E07,0xFFFF,0xFFFF,0xF800,
  326.     0x79F9,0xFFFF,0xFFFF,0xF800,0x75FE,0x7FFF,0xF9CC,0x7800,
  327.     0x22BF,0x2AAA,0xAEBD,0xE800,0x4057,0xCFFF,0xFFFD,0xF800,
  328.     0x100B,0xE2AA,0xAABD,0xE800,0x4805,0x78DD,0xDFFD,0xD800,
  329.     0x1500,0xBE2A,0xAAA8,0xA800,0x0AA0,0x54D1,0x3FF5,0xD000,
  330.     0x1F50,0x0BEA,0xAAA8,0xA800,0x19EA,0x07E0,0x57D5,0xC000,
  331.     0x1A75,0x4630,0xA228,0xA800,0x1B3E,0x8ED0,0x6337,0x0000,
  332.     0x1B4F,0x6EF0,0xA000,0x8000,0x1B73,0xAF21,0x4003,0x0000,
  333.     0x197C,0xAF30,0x9320,0x9000,0x0E7F,0x2F91,0x0413,0x0000,
  334.     0x53FF,0xEFF6,0xD964,0xD000,0x20FF,0xEFF0,0x3612,0x2000,
  335.     0x553F,0xEFF2,0x4D64,0xD000,0x2A8F,0xEFE0,0x929A,0x2800,
  336.     0x5513,0xEF93,0x6FA6,0x5000,0x6AB8,0xEE23,0x954A,0x3800,
  337.     0x5511,0x2941,0x0006,0x5000,0x7FBB,0x87FF,0xFFFF,0xF800,
  338.     0x7FBB,0xFFFF,0xFFFF,0xF800,0x7F83,0xFFFF,0xFFFF,0xF800,
  339.     0x0000,0x0000,0x0000,0x0000
  340. };
  341.  
  342. struct Image yamunsel =
  343. {
  344.     0, 0,        /* LeftEdge, TopEdge */
  345.     54, 29, 3,    /* Width, Height, Depth */
  346.     yamunselData,    /* ImageData */
  347.     0x0007, 0x0000,    /* PlanePick, PlaneOnOff */
  348.     NULL        /* NextImage */
  349. };
  350.  
  351. void main()
  352. {
  353.     ULONG            r=TRUE;
  354.     struct PopupMenu    *p;        // Pointer to our menu
  355.     struct Screen        *scr;
  356.     struct Image        *amiga=0L;    // Amiga Image
  357.  
  358.     w.LeftEdge=0;
  359.     w.TopEdge=0;
  360.  
  361.     PopupMenuBase=(struct PopupMenuBase *)OpenLibrary(POPUPMENU_NAME,POPUPMENU_VERSION);            // Open the library
  362.     if(PopupMenuBase) {
  363.         IntuitionBase=(struct IntuitionBase *)PopupMenuBase->pmb_IntuitionBase;    // We let popupmenu.library open the libraries we need
  364.         GfxBase=(struct GfxBase *)PopupMenuBase->pmb_GfxBase;            // They remain valid until the library is closed!
  365.  
  366.         scr=LockPubScreen(NULL);
  367.         if(scr) {
  368.             p=PM_MakeMenu(        // Create a very simple start-menu...
  369.                 PMItem("Miami"),    PM_UserData,    10,    PM_IconSelected,    &miamisel,    PM_IconUnselected,    &miamiunsel,    End,
  370.                 PMItem("IBrowse"),    PM_UserData,    20,    PM_IconSelected,    &nn,                            End,
  371.                 PMItem("YAM"),        PM_UserData,    30,    PM_IconSelected,    &yamsel,    PM_IconUnselected,    &yamunsel,    End,
  372.                 PMTitleBar,                                                            End,
  373.                 PMItem("Quit"),        PM_UserData,    5,                                            End,
  374.                 End;
  375.  
  376.             w.WScreen=scr;
  377.             w.MouseY=scr->Height;
  378.  
  379.             if(p) {
  380.                 printf("StartMenu is now running.\nMove the mousepointer to the bottom of the screen to open the menu.\nThis demo may cause deadlocks (e.g. if you move an icon to the bottom of the screen), but they should be solved quickly.\nA better startmenu example will follow soon...\n");
  381.                 while(r) {
  382.                     Delay(4);                // A CX object would be better...
  383.                     if(scr->MouseY>scr->Height-3) {        // If we're somewhere near the bottom of the screen...
  384.                         w.MouseX=scr->MouseX;
  385.                         r=(ULONG)(PM_OpenPopupMenu(&w,    // Open our start menu!
  386.                             PM_Menu,        p,
  387.                             PM_WideSelectBar,    TRUE,
  388.                             PM_SameHeight,        FALSE,
  389.                             PM_SmartRefresh,    TRUE,
  390.                             // No PM_Code here, since we don't open the menu when the mouse button is clicked/released
  391.                             TAG_DONE));
  392.                         switch(r) {
  393.                             /* Take care of the return codes here. (PM_UserData is returned) */
  394.                             case 30:
  395.                                 system("Run COMM:YAM/YAM");
  396.                                 break;
  397.                             case 20:
  398.                                 system("Run COMM:IBrowse/IBrowse");
  399.                                 break;
  400.                             case 10:
  401.                                 system("Run COMM:Miami/Miami");
  402.                                 break;
  403.                         }
  404.                         r-=5;    // When we get a 5 from OpenPopupMenu we make it into a 0, and the program exits!
  405.                     }
  406.                 }
  407.             } else printf("Menu error!\n");
  408.             PM_FreePopupMenu(p);
  409.         } else printf("No public screen!\n");
  410.         CloseLibrary((struct Library *)PopupMenuBase);
  411.     }
  412. }
  413.